package logic;

import java.io.File;

import java.io.IOException;
import java.util.ArrayList;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;

/** 
 * Constantes de programa
 */

public class Constantes {

	
	public static ArrayList<String> Images;
	public final static String ImagesPatch = "Images.xml" ;
	public final static int DELAY_DEBUGGER = 2500; // milisegundos

	public static final int CASILLAS_X 	= 20;
	public static final int CASILLAS_Y 	= 20;
	public static final int DEFAULT_LABEL_WIDTH = 50;
	public static final int DEFAULT_LABEL_HEIGHT = 50;
	public static final int DEFAULT_BOARD_WIDTH = 1000;
	public static final int DEFAULT_BOARD_HEIGHT = 1000;
	
	public static final int POS_X		= 0;
	public static final int POS_Y		= 1;
	
	// Types
	public static final int TYPE_PIPE	= 0;
	public static final int TYPE_COMMAND		= 1;
	public static final int TYPE_VAR			= 2;
	
	// Ids pipes
	public static final int ID_VERT_UP	= 0;
	// Ids command
	
	// posiciones alrededor del token
	public static final int CNT_POS	= 9;
	public static final int POS_NW	= 0;
	public static final int POS_N	= 1;
	public static final int POS_NE	= 2;
	public static final int POS_W	= 3;
	public static final int POS_E	= 5;
	public static final int POS_SW	= 6;
	public static final int POS_S	= 7;
	public static final int POS_SE	= 8;
	
	// ids de Pipes
	public static final int ID_WE = 0;
	public static final int ID_NS = 1;
	public static final int ID_NW = 2;
	public static final int ID_NE = 3;
	public static final int ID_SE = 4;
	public static final int ID_SW = 5;

	
	// opciones de adyacencia
	public static final int ADY_NONE		= 0;
	public static final int ADY_ANY			= 1;
	public static final int ADY_PIPE		= 2; // usada para var
	public static final int ADY_VAR			= 3;
	public static final int ADY_LED			= 4;
	public static final int ADY_IF			= 5;
	public static final int ADY_DELAY		= 6;
	public static final int ADY_LINEAL		= 7;
	public static final int ADY_PIPE_IN		= 8;
	public static final int ADY_PIPE_OUT	= 9;
	
	// imagenes de bloques
	public static final String IMAGE_FOLDER = "GIFS/";
	public static final String IMAGE_ERROR 	= "block_error";
	public static final String IMAGE_STATIC = "_static";
	public static final String IMAGE_ANIM 	= "_anim";
	public static final String IMAGE_FORMAT = ".gif";

	public static final String CONFIG_ADYACENCIAS_PATCH = "Config.xml";
	
	public final static String IMAGES[][] = {
		{
			 "GIFS/pipe_we_static.gif" , 
			 "GIFS/pipe_ns_static.gif" ,
			 "GIFS/pipe_nw_static.gif" , 
			 "GIFS/pipe_ne_static.gif" , 
			 "GIFS/pipe_es_static.gif" , 
			 "GIFS/pipe_ws_static.gif" 
		},{
			 "GIFS/if_static.gif" , 
			 "GIFS/led_static.gif",
			 "GIFS/delay_static.gif" , 
			 "GIFS/potenc_static.gif",
			 "GIFS/7seg_static.gif" , 
			 "GIFS/modificador.gif",
			 "GIFS/foto_static.gif",
			 "GIFS/boton_static.gif",
			 "GIFS/fin_static.gif",
			 "GIFS/llamada_static.gif"
		},{
			"GIFS/inicio_static.gif"
		},{
			"GIFS/Var_0.png",
			"GIFS/Var_1.png",
			"GIFS/Var_2.png",
			"GIFS/Var_3.png",
			"GIFS/Var_4.png",
			"GIFS/Var_5.png",
			"GIFS/Var_6.png",
			"GIFS/Var_7.png",
			"GIFS/Var_8.png",
			"GIFS/Var_9.png",
		},{
			 "GIFS/pipe_we_anim.gif" , 
			 "GIFS/pipe_ns_anim.gif" ,
			 "GIFS/pipe_nw_anim.gif" , 
			 "GIFS/pipe_ne_anim.gif" , 
			 "GIFS/pipe_es_anim.gif" , 
			 "GIFS/pipe_ws_anim.gif" 
		},{
			 "GIFS/if_anim.gif" , 
			 "GIFS/led_anim.gif",
			 "GIFS/delay_anim.gif" , 
			 "GIFS/potenc_anim.gif",
			 "GIFS/7seg_anim.gif" , 
			 "GIFS/modificador.gif",
			 "GIFS/foto_anim.gif",
			 "GIFS/boton_anim.gif",
			 "GIFS/fin_anim.gif",
			 "GIFS/llamada_anim.gif"
		}
	};
	
	public static final int ID_IF		= 0;
	public static final int ID_LED		= 1;
	public static final int ID_DELAY	= 2;
	public static final int ID_POTENC	= 3;
	public static final int ID_7SEG		= 4;
	public static final int ID_MODIF	= 5;
	public static final int ID_FOTOREST	= 6;
	public static final int ID_BOTON	= 7;
	public static final int ID_END     	= 8;
	public static final int ID_FUNTION  = 9;
	public static final int ID_INICIO	= 10;
	
	public final static int[][] COLORS = {
		{ 256 , 0 , 0 },
		{ 0 , 256 , 0 },
		{ 0 , 0 , 256 },
		{ 256 , 256 , 0 },
		{ 256 , 0 , 256 },
		{ 0 , 256 , 256 },
		{ 0 , 0 , 0 }
	};
}
